﻿using System;
using System.Collections.Generic;
using System.Text;
using VoteServices;
using VoteServices.VoteClass;
using VoteServices.VoteModel;

namespace Vote
{
    public class Program
    {
        static void Main(string[] args)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            Models models = new Models();
            User user = null;
            Console.WriteLine(" 投票系统");
            Console.WriteLine("==========");
            while (user == null)
            {
                user= InterfaceService._Login();
            }
            UserModel userModel = models.userModel(user);
            ProblemModel problemModel = new ProblemModel();
            Console.Clear();
            int select = 0;
            while (select != 3)
            {
                InterfaceService._FunctionSelect(userModel);
                VoteData data = new VoteData();
                select = int.Parse(Console.ReadLine());
                if (select == 1)
                {
                    Console.Clear();
                    InterfaceService.Vote(user);
                    Console.Clear();
                }
                else if (select == 2)
                {
                    Console.Clear();
                    InterfaceService.ViewResults();
                    
                }
                else if (select == 3)
                    break;
                else
                {
                    Console.WriteLine("暂无此功能，请重新输入");
                    select = 0;
                }
            }


        }
    }
    
}
